
package com.qingzhuge.member.enums;

import com.qingzhuge.common.IBaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : zero.xiao
 * @description :
 * @date :2018/9/25 0025 下午 17:12
 * @since : 1.0.0
 * @modified :
 */
@ApiModel("消息类型")
public enum EnumUserMessageType implements IBaseEnum<String> {
    /**未定义*/
    @ApiModelProperty("未定义")
    UNKNOWN("unknown"),
    /**系统*/
    @ApiModelProperty("系统消息")
    SYSTEM("system"),
    /**用户*/
    @ApiModelProperty("用户消息")
    USER("user"),
    /**普通*/
    @ApiModelProperty("普通消息")
    GENERAL("general");

    private final String value;
    private final static Map<String, EnumUserMessageType> VALUE_CACHE = new HashMap<>();

    static {
        for (EnumUserMessageType c: values()) {
            VALUE_CACHE.put(c.value, c);
        }
    }

    EnumUserMessageType(String value) {
        this.value = value;
    }

    @Override
    public String value() {
        return this.value;
    }

    public static EnumUserMessageType fromValue(String value) {
        return VALUE_CACHE.get(value);
    }

    @Override
    public String toString() {
        return this.value;
    }

}
